<!--{include(pe_tpl('header.html'));}-->
<div class="right_page">
	<div class="now">
		<a href="javascript:;" class="sel">{$menutitle}<i></i></a>
		<div class="clear"></div>
	</div>
	<form method="post" id="form">
	<div class="right_main">
		<div class="tixing corg">提示：全站通用的优惠券无需选择限定商品</div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 mab20">
		<tr>
			<td align="right" width="200">领取方式：</td>
			<td>
				<!--{foreach($ini['quan_type'] as $k=>$v):}-->
				<label class="mar30"><input type="radio" name="info[quan_type]" value="{$k}" class="inputfix" <!--{if($info['quan_type']==$k):}-->checked="checked"<!--{endif;}--> {$disabled} /> {$v}</label>
				<!--{endforeach;}-->
			</td>
		</tr>
		<tr>
			<td align="right">优惠券名：</td>
			<td><input type="text" name="info[quan_name]" value="{$info['quan_name']}" class="inputall input400" {$disabled} /></td>
		</tr>
		<tr>
			<td align="right">有效日期：</td>
			<td>
				<select name="info[quan_datetype]" class="inputselect fl mar10"  style="width:122px" {$disabled} />
				<!--{foreach(array('absolute'=>'固定日期区间', 'relative'=>'自领取日开始') as $k=>$v):}-->
				<option value="{$k}"  <!--{if($info['quan_datetype']==$k):}-->selected="selected"<!--{endif;}-->>{$v}</option>
				<!--{endforeach;}-->
				</select>
				<div class="fl quan_datetype" type="absolute">
					<input type="text" name="info[quan_sdate]" value="{$info['quan_sdate']}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate inputall input100 mar5" {$disabled} />
					至 <input type="text" name="info[quan_edate]" value="{$info['quan_edate']}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate inputall input100 mal5" {$disabled} />			
				</div>
				<div class="fl quan_datetype divhide" type="relative">
					<input type="text" name="info[quan_day]" value="{$info['quan_day']}" class="inputall input100" {$disabled} /> 天内有效
				</div>
				<div class="clear"></div>
			</td>
		</tr>
		<tr>
			<td align="right">优惠金额：</td>
			<td>
				<input type="text" name="info[quan_money]" value="{$info['quan_money']}" class="inputall input100" {$disabled} /> 元，
				满 <input type="text" name="info[quan_limit]" value="{$info['quan_limit']}" class="inputall input100" {$disabled} /> 元可使用
			</td>
		</tr>
		<tr>
			<td align="right">发放数量：</td>
			<td><input type="text" name="info[quan_num]" value="{$info['quan_num']}" class="inputall input100" /> 张</td>
		</tr>
		<tr>
			<td align="right">每人限领：</td>
			<td>
				<input type="text" name="info[quan_limitnum]" value="{$info['quan_limitnum']}" class="inputall input100" /> 张
				<span class="c999">（不填或填0为不限数量）</span>
			</td>
		</tr>
		<tr id="quan_code" class="divhide">
			<td align="right">兑换口令：</td>
			<td><input type="text" name="info[quan_code]" value="{$info['quan_code']}" class="inputall input200" /></td>
		</tr>
		</table>
	</div>
	<div class="now">
		<a href="javascript:;" class="sel">限定商品（<span id="product_num">{count($product_list)}</span>）<i></i></a>
		<a href="admin.php?mod=quan&act=product_list&id={$info['quan_id']}" onclick="return pe_dialog(this, '添加商品', 1000, 600)" id="fabu">添加商品</a>
		<div class="clear"></div>
	</div>
	<div class="right_main">
		<table border="0" cellspacing="0" cellpadding="0" class="list" id="product_list">
		<tr>
			<th class="bgtt" width="50">ID号</th>
			<th class="bgtt" width="40"></th>
			<th class="bgtt">商品名称</th>
			<th class="bgtt" width="150">单价(元)</th>
			<th class="bgtt" width="100">操作</th>
		</tr>
		<!--{foreach($product_list as $v):}-->
		<tr class="js_product" id="{$v['product_id']}">
			<td>{$v['product_id']}<input type="hidden" name="product_id[]" value="{$v['product_id']}" /></td>
			<td><img src="{pe_thumb($v['product_logo'], 100, 100)}" width="40" height="40" class="imgbg" /></td>
			<td class="left"><a href="{pe_url('product-'.$v['product_id'])}" target="_blank" class="cblue">{$v['product_name']}</a></td>
			<td><span class="corg">{$v['product_money']}</span></td>
			<td><a href="javascript:;" class="admin_btn">删除</a></td>
		</tr>
		<!--{endforeach;}-->
		</table>
	</div>
	<div class="right_bottom center">
		<input type="hidden" name="pe_token" value="{$pe_token}" />
		<input type="hidden" name="pesubmit" value="{$pe_token}" />
		<input type="button" value="提 交" class="tjbtn">
	</div>
	</form>
</div>
<link rel="stylesheet" href="{$pe['host']}include/plugin/layui/css/layui.css">
<script src="{$pe['host']}include/plugin/layui/layui.js"></script>
<script type="text/javascript" src="{$pe['host']}include/plugin/my97/WdatePicker.js"></script>
<script type="text/javascript">
$(function(){
	$(":input[name='info[quan_type]']").change(function(){	
		if ($(":input[name='info[quan_type]']:checked").val() == 'offline') {
			$("#quan_code").show();
		}
		else {
			$("#quan_code").hide();		
		}
	})
	$(":input[name='info[quan_type]']").change();
	$(":input[name='info[quan_datetype]']").change(function(){
		var quan_datetype = $(":input[name='info[quan_datetype]'] option:selected").val();
		$(".quan_datetype").hide();
		$(".quan_datetype[type='"+quan_datetype+"']").show();		
	})
	$(":input[name='info[quan_datetype]']").change();
	$("#product_list .admin_btn").live("click", function(){
		$(this).parents("tr").remove();
		$("#product_num").html($(".js_product").length);
	})
	$(":input[disabled='disabled']").css("background-color", "#f6f6f6")
	$(":button").click(function(){
		pe_submit("{pe_nowurl()}", function(json){
			if (json.code == 1) pe_open('back', 1000);
		});
	})
})
layui.use(['form'], function(){
	form = layui.form;
});
</script>
<!--{include(pe_tpl('footer.html'));}-->